﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FisApp
{
    public partial class FrmMessage : Form
    {
        public string _message;
        enums.MessageTypes _messagetype;


        public FrmMessage(string message, enums.MessageTypes messagetype)
        {
            InitializeComponent();

            _message = message;
            _messagetype = messagetype;

            Init();
        }

        private void Init()
        {
            lblMessage.Text = _message;

            if (_messagetype == enums.MessageTypes.Error)
                lblMessage.Appearance.Image = FisApp.Properties.Resources.stop;
            if (_messagetype == enums.MessageTypes.Warning)
                lblMessage.Appearance.Image = FisApp.Properties.Resources.Warning;
            if (_messagetype == enums.MessageTypes.Information)
                lblMessage.Appearance.Image = FisApp.Properties.Resources.Information;
            if (_messagetype == enums.MessageTypes.Question) //TODO: question resmi eklenecek
                lblMessage.Appearance.Image = FisApp.Properties.Resources.Warning;
        }
        
        static DialogResult result = DialogResult.No;

        public static DialogResult ShowDialogResult(string message, enums.MessageTypes messagetype)
        {
            FrmMessage msgDialog = new FrmMessage(message, messagetype);
            msgDialog.btn_Iptal.Visible = true;
            result = DialogResult.No;
            msgDialog.ShowDialog();
            return result;
        }

        public static void show(string message, enums.MessageTypes messagetype)
        {
            new FrmMessage(message, messagetype).Show();
        }

        public static void showDialog(string message, enums.MessageTypes messagetype)
        {
            new FrmMessage(message, messagetype).ShowDialog();
        }

        private void btn_Tamam_Click(object sender, EventArgs e)
        {
            result = DialogResult.Yes;
            this.Close();
        }

        private void btn_Iptal_Click(object sender, EventArgs e)
        {
            result = DialogResult.No;
            this.Close();
        }
    }
}
